package com.ces.knacky.model;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.xml.bind.annotation.XmlMimeType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

import org.apache.commons.lang.builder.EqualsBuilder;


import com.ces.knacky.framework.model.AbstractTenantEntity;

/** @author Hibernate CodeGenerator */
@XmlRootElement

public class Item  extends AbstractTenantEntity implements Serializable {

    /** persistent field */
    private String title;

    /** nullable persistent field */
    private Float expectedPrice;

    /** persistent field */
    private com.ces.knacky.model.ItemWorkflowStatus itemWorkflowStatus;

    /** persistent field */
    private com.ces.knacky.model.Item parent;

    /** persistent field */
    private com.ces.knacky.model.Company company;
    
    /** persistent field */
    private String code;
    
    /** persistent field */
    private Set bidWorkflowAudits;

    /** persistent field */
    private Set orderItems;

    /** persistent field */
    private Set itemBrands;

    /** persistent field */
    private Set auctionItems;

    /** persistent field */
    private Set itemWorkflowAudits;

    /** persistent field */
    private Set inventories;

    /** persistent field */
    private Set items;

    /** persistent field */
    private Set bids;

    /** persistent field */
    private Set itemCategories;

    /** full constructor */
    public Item(String title, String description, Float expectedPrice, Date createTime, Date updateTime, com.ces.knacky.model.ItemWorkflowStatus itemWorkflowStatus, com.ces.knacky.model.Flag flag, com.ces.knacky.model.Item item, com.ces.knacky.model.Company company, com.ces.knacky.model.UserTable user, Set bidWorkflowAudits, Set orderItems, Set itemBrands, Set auctionItems, Set itemWorkflowAudits, Set inventories, Set items, Set bids, Set itemCategories) {
        this.title = title;
        this.description = description;
        this.expectedPrice = expectedPrice;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.itemWorkflowStatus = itemWorkflowStatus;
        this.flag = flag;
        this.parent = item;
        this.company = company;
        this.user = user;
        this.bidWorkflowAudits = bidWorkflowAudits;
        this.orderItems = orderItems;
        this.itemBrands = itemBrands;
        this.auctionItems = auctionItems;
        this.itemWorkflowAudits = itemWorkflowAudits;
        this.inventories = inventories;
        this.items = items;
        this.bids = bids;
        this.itemCategories = itemCategories;
    }

    /** default constructor */
    public Item() {
    }

    /** minimal constructor */
    public Item(String title, String description, com.ces.knacky.model.ItemWorkflowStatus itemWorkflowStatus, com.ces.knacky.model.Flag flag, com.ces.knacky.model.Item item, com.ces.knacky.model.Company company, com.ces.knacky.model.UserTable user, Set bidWorkflowAudits, Set orderItems, Set itemBrands, Set auctionItems, Set itemWorkflowAudits, Set inventories, Set items, Set bids, Set itemCategories) {
        this.title = title;
        this.description = description;
        this.itemWorkflowStatus = itemWorkflowStatus;
        this.flag = flag;
        this.parent = item;
        this.company = company;
        this.user = user;
        this.bidWorkflowAudits = bidWorkflowAudits;
        this.orderItems = orderItems;
        this.itemBrands = itemBrands;
        this.auctionItems = auctionItems;
        this.itemWorkflowAudits = itemWorkflowAudits;
        this.inventories = inventories;
        this.items = items;
        this.bids = bids;
        this.itemCategories = itemCategories;
    }

    public Float getExpectedPrice() {
        return this.expectedPrice;
    }

    public void setExpectedPrice(Float expectedPrice) {
        this.expectedPrice = expectedPrice;
    }
    
    public com.ces.knacky.model.ItemWorkflowStatus getItemWorkflowStatus() {
        return this.itemWorkflowStatus;
    }

    public void setItemWorkflowStatus(com.ces.knacky.model.ItemWorkflowStatus itemWorkflowStatus) {
        this.itemWorkflowStatus = itemWorkflowStatus;
    }

    
    public com.ces.knacky.model.Item getParent() {
        return this.parent;
    }

    public void setParent(com.ces.knacky.model.Item item) {
        this.parent = item;
    }

    public com.ces.knacky.model.Company getCompany() {
        return this.company;
    }

    public void setCompany(com.ces.knacky.model.Company company) {
        this.company = company;
    }

    public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public com.ces.knacky.model.UserTable getUser() {
        return this.user;
    }

    public void setUser(com.ces.knacky.model.UserTable user) {
        this.user = user;
    }

    @XmlTransient
    public Set getBidWorkflowAudits() {
        return this.bidWorkflowAudits;
    }

    public void setBidWorkflowAudits(Set bidWorkflowAudits) {
        this.bidWorkflowAudits = bidWorkflowAudits;
    }

    @XmlTransient
    public Set getOrderItems() {
        return this.orderItems;
    }

    public void setOrderItems(Set orderItems) {
        this.orderItems = orderItems;
    }

    @XmlTransient
    public Set getItemBrands() {
        return this.itemBrands;
    }

    public void setItemBrands(Set itemBrands) {
        this.itemBrands = itemBrands;
    }

    @XmlTransient
    public Set getAuctionItems() {
        return this.auctionItems;
    }

	public String getTitle() {
		return title;
	}

	
	public void setTitle(String title) {
		this.title = title;
	}

	public void setAuctionItems(Set auctionItems) {
        this.auctionItems = auctionItems;
    }
	@XmlTransient
    public Set getItemWorkflowAudits() {
        return this.itemWorkflowAudits;
    }

    public void setItemWorkflowAudits(Set itemWorkflowAudits) {
        this.itemWorkflowAudits = itemWorkflowAudits;
    }
    
    @XmlTransient
    public Set getInventories() {
        return this.inventories;
    }

    public void setInventories(Set inventories) {
        this.inventories = inventories;
    }
    
    @XmlTransient
    public Set getItems() {
        return this.items;
    }

    public void setItems(Set items) {
        this.items = items;
    }

    @XmlTransient
    public Set getBids() {
        return this.bids;
    }

    public void setBids(Set bids) {
        this.bids = bids;
    }

    
    @XmlTransient
    public Set getItemCategories() {
        return this.itemCategories;
    }

    public void setItemCategories(Set itemCategories) {
        this.itemCategories = itemCategories;
    }

    public boolean equals(Object other) {
        if ( !(other instanceof Item) ) return false;
        Item castOther = (Item) other;
        return new EqualsBuilder()
            .append(this.getId(), castOther.getId())
            .isEquals();
    }
    /**
     * It is used to fetch thumbnail image from the specified location and pass it to the JSP
     * page for rendering. 
     * 
     * @return	String
     * 			Represents image path.
     */
    public String getThumbnail() {
    	return "images/thumbnail/" + getId() + ".jpg";
    }
}
